package com.neutech.shop.mapper.impl;

import com.neutech.shop.entity.Admin;
import com.neutech.shop.mapper.AdminMapper;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Neuedu-远哥
 * @version 1.0
 * @date 2021/9/15 15:41
 */
@Repository
public class AdminMapperImpl extends SqlSessionDaoSupport implements AdminMapper {
    @Resource
    @Override
    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
        super.setSqlSessionFactory(sqlSessionFactory);
    }

    @Override
    public List<Admin> selectAll() {

        return getSqlSession().getMapper(AdminMapper.class).selectAll();
    }

    @Override
    public void update(Admin admin) {
        getSqlSession().getMapper(AdminMapper.class).update(admin);
    }

    @Override
    public void delete(Long id) {
        getSqlSession().getMapper(AdminMapper.class).delete(id);
    }

    @Override
    public Admin selectById(Long id) {
        return getSqlSession().getMapper(AdminMapper.class).selectById(id);
    }

    @Override
    public void resetPassword(Long id) {
        getSqlSession().getMapper(AdminMapper.class).resetPassword(id);
    }

    @Override
    public Admin findByName(String name) {
        return getSqlSession().getMapper(AdminMapper.class).findByName(name);
    }
}
